package logic

import (
	"context"
	"homepage_srv/homepage"
	"homepage_srv/internal/dao"
	"homepage_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodSearchLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodSearchLogic {
	return &GoodSearchLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 商品搜索
func (l *GoodSearchLogic) GoodSearch(in *homepage.GoodSearchRequest) (*homepage.GoodSearchResponse, error) {
	goods := dao.GoodSearch(in.StoreName)
	return &homepage.GoodSearchResponse{
		List: goods,
	}, nil
}
